﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace yafc.Interface.Api
{
	public class Entry
	{
		private string url;
		private Dictionary<string, string> parameters = new Dictionary<string, string>();

		public Entry(string URL)
		{
			url = URL;
		}

		public string value
		{
			get
			{
				string ret = url;
				foreach (KeyValuePair<string, string> e in parameters)
				{
					ret += "?" + e.Key + "=" + e.Value;
				}
				return ret;
			}
		}

		public void addParam(string Key, string Value)
		{
			parameters.Add(Key, Value);
		}

		public string getParam(string Key)
		{
			string value;
			if (parameters.TryGetValue(Key, out value))
			{
				return value;
			}
			throw new FieldAccessException("No such parameters set: Key - " + Key);
		}
	}
}
